<?php

use App\Enums\OpenShop\InvestmentPromotion\MainProcessEnum;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopCheckAccept extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_check_accept', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('mainProcessId')->default(0)->comment('开店主流程id');
            $table->string('orderNo', 60)->default('')->comment('开店订单号');
            $table->unsignedTinyInteger('step')->default(0)->comment(enumToMigrationComment(MainProcessEnum::MAIN_PROCESS_SHOP_CHECK_MAP, "门店验收步骤"));

            $table->string('managerName', 60)->default('')->comment('经理名称');
            $table->unsignedInteger('managerId')->default(0)->comment('经理id');
            $table->unsignedInteger('assignTime')->default(0)->comment('指派经理时间');

            $table->text("formContent")->nullable(true)->comment("表单内容");
            $table->text("formSubmit")->nullable(true)->comment("表单提交内容");
            $table->unsignedInteger('formSubmitTime')->default(0)->comment('表单提交时间');


            $table->unsignedInteger('provinceManagerConfirmTime')->default(0)->comment('省总确认时间');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '开店 - 工程验收阶段';

            $table->unique(['orderNo'], 'idx_orderNo');
            $table->unique(['mainProcessId'], 'idx_mainProcessId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_check_accept');
    }
}
